home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / dviware / quicspool / libqmsquery / qmsfnt.y < prev    next >
Text File  |  1990-10-01  |  2KB  |  95 lines

  1. %{
  2. #ifndef lint
  3. static char *rcs = "$Header: qmsfnt.y,v 1.1 88/01/15 12:18:57 simpson Rel $";
  4. #endif
  5. /*
  6. $Log:    qmsfnt.y,v $
  7.  * Revision 1.1  88/01/15  12:18:57  simpson
  8.  * initial release
  9.  * 
  10.  * Revision 0.1  87/12/11  17:11:59  simpson
  11.  * beta test
  12.  * 
  13. */
  14. #include <stdio.h>
  15. #include <setjmp.h>
  16. #include <local/standard.h>
  17. #include "qms.h"
  18.  
  19. extern FILE    *_Ifp, *_Ofp;
  20. extern Boolean    _FirstChar;
  21. static jmp_buf    Env;
  22. char        *malloc();
  23. static struct qmsfnt    Fnt;
  24. static struct fontnode    *P;
  25. %}
  26. %token FRO FDL INTEGER CHAR NONE ENDLINE
  27. %%
  28. fntlines : fntlines fntline | /* epsilon */ ;
  29.  
  30. fntline : 
  31.     fonttype NONE ENDLINE
  32.     {
  33.         if ($1 == FRO)
  34.         Fnt.rom = NULL;
  35.         else
  36.         Fnt.ram = NULL;
  37.     }
  38.     |
  39.     fonttype orientation INTEGER 'S' INTEGER 'V' anychar 'C' anychar ENDLINE
  40.     {
  41.         P = (struct fontnode *)malloc((unsigned)sizeof(struct fontnode));
  42.         if ($1 == FRO) {
  43.         P->next = Fnt.rom, Fnt.rom = P;
  44.         } else {
  45.         P->next = Fnt.ram, Fnt.ram = P;
  46.         }
  47.         P->orientation = $2;
  48.         P->number = $3;
  49.         P->bytes = $5;
  50.         P->version = $7;
  51.         P->class = $9;
  52.     }
  53.     ;
  54.  
  55. fonttype : FRO | FDL ;
  56.  
  57. orientation : 'P' | 'L' ;
  58.  
  59. anychar : 
  60.     'P' | 'L' | 'S' | 'V' | 'C' | CHAR 
  61.     | 
  62.     INTEGER
  63.     {
  64.         $$ = '0' + $1;
  65.     }
  66.     ;
  67. %%
  68. #include "qmsfntlex.c"
  69.  
  70. struct qmsfnt *qmsfnt()
  71. {
  72.     _FirstChar = TRUE;
  73.     Fnt.rom = Fnt.ram = NULL;
  74.     fputs(QUICON, _Ofp);
  75.     fprintf(_Ofp, "%s00000", SYNTAX);
  76.     fprintf(_Ofp, "%sFNTB%s", INFO, ENDCMD);
  77.     fputs(QUICOFF, _Ofp);
  78.     (void)fflush(_Ofp);
  79.     if (setjmp(Env)) {
  80.     while (timedgetc(_Ifp) != EOF)    /* Discard remaining input */
  81.         ;
  82.     return NULL;
  83.     }
  84.     if (yyparse() != 0)
  85.     return NULL;
  86.     yysptr = yysbuf;        /* Resets lex lookahead buffer */
  87.     return &Fnt;
  88. }
  89.  
  90. static yyerror(s)
  91. char    *s;
  92. {
  93.     longjmp(Env, TRUE);
  94. }
  95.